home *** CD-ROM | disk | FTP | other *** search
- Path: ccnet.com!not-for-mail
- From: jantypas@ccnet.com (John Antypas)
- Newsgroups: comp.lang.c++
- Subject: Call order of constructors
- Date: 14 Feb 1996 16:34:31 -0800
- Organization: CCnet Communications
- Message-ID: <4ftv2n$kts@ccnet3.ccnet.com>
- NNTP-Posting-Host: ccnet3
-
- Hello C++ wizards...
-
- I'm trying to create a library access some private netowrk resources.
- I thought I'd try something like this:
-
- class TRANSPORT {
- ... magic stuff...
- public:
- TRANSPORT(char *name) // Called to activate and bind transport(name)
- ~TRANSPORT() // Called when we're done with transport(name)
-
- }
-
- class SESSION(
- TRANSPORT transport&;
- ....
- SESSION(char *transport_name,
- char *transport_address);
- ~SESSION();
- ....
- }
-
- I was hoping that main code such as :
-
- SESSION my_session("iee488", "unit-4B");
-
- would create a session on the IEEE488 controller, to unit Unit-4B, specifically, - open a trasnport to the IEEE-488 system by calling the IEEE488
- constructor
- - open a session by calling the session constructor and have it
- finish the job.
-
- The destructor sequence runs in the exact reverse.
-
- First off, the compiler complains about the TRANSPORT constructors, second,
- I find myself asking what to do if a constructor or destructor fails?
- How do I catch the error condition to notify outer levels of the program?
-
- Help as always is appreciated.
-
- John Antypas jantypas@soft21.s21.com
-
- --
- John Antypas@21st Century Softwware (jantypas@soft21.s21.com)
-
- "God is too busy to create chaos and disorder in this world, he can't be
- everywhere at once all of the time, That's why he made two year olds"
-